1. Field of the Invention
The present invention,relates in general to thermometer-to-binary encoding systems and in particular to an encoding system which reduces errors in an output binary code resulting from out-of-sequence errors in an input thermometer code.
1. Description of Related Art
A number may be represented by a thermometer code wherein successive bits of a data word are assigned progressively larger values. All thermometer code bits having assigned values below or the same as the number are set to a logical true state (e.g. logical "1") and all of the bits having values higher than the number are set to a logical false state (e.g. logical "0"). In a typical analog-to-digital (A/D) converter, a reference voltage is divided into a set of progressively smaller reference voltage quantum levels. A comparator associated with each quantum level compares an analog input voltage with the voltage quantum and generates an output true state if the input voltage is higher than the voltage quantum reference. The outputs of all comparators form the bits of a thermometer code representing the magnitude of the input voltage when arranged in order of the associated reference voltage quantum level magnitudes.
In comparison to most other commonly used codes, thermometer codes do not represent numbers efficiently in terms of the number of bits required. For example, an eight-bit thermometer code can represent any one of 9 different numbers (0-8) whereas a typical eight-bit binary code can represent 256 different numbers. Therefore the thermometer code output of an A/D converter is usually itself converted by an encoding circuit into another more compact and useful binary code before being transmitted as data to external data processing circuits.
A problem arises when the bits of the thermometer code are out of sequence, i.e., when logical-true bits in the code are separated by one or more intervening logical-false bits. For example thermometer code "00011101" contains an out-of-sequence error. The "span" of the out-of-sequence error is equal to the number of intervening bits between the highest order "1" in the code and the highest order in-sequence "1" In the example the out-of-sequence error span is 3. An out-of-sequence error can happen when the thermometer code is produced by an A/D converter sampling a high frequency input signal where the individual comparators of the converter do not all switch at the same speed. For example, when the input signal voltage is falling at the time the A/D converter samples it, a fast lower order comparator may switch to a low output state before a relatively slower higher order comparator. When the out-of-sequence thermometer code is applied as an input to a typical thermometer-to-binary encoder, the output of the encoder may bear little relation to the actual magnitude of the sampled voltage. For many A/D converters a good approximation of the most likely magnitude of a sampled voltage which produces an out-of-sequence thermometer code is obtained by simply counting (summing) the logical-true bits in the out-of-sequence thermometer code. Thus engineers typically define the "value" of a thermometer code as the sum of its logical-true bits.
However, for typical systems, the cost in logic stages and processing times of a mechanism to directly add the individual bits of a thermometer code is prohibitive. Practical thermometer-to-binary encoders produce an output binary code whose value is equal to the value of the input thermometer code when the input code contains no out-of-sequence errors, but whose value may differ quite significantly from the value of the input thermometer code in the presence of out-of-sequence errors. Any difference between the value of the binary output code and the value of the thermometer input code is referred to as "encoding error." In the remainder of this specification, phrases such as "thermometer-to-binary encoder," "binary representation of thermometer code," "convert thermometer code to binary," etc., refer to an apparatus for or method of converting a thermometer code to a binary code that may contain encoding errors in the presence of out-of-sequence inputs.
U.S. Pat. No. 4,586,025 issued Apr. 29, 1986 to Daniel G. Knierim describes an error tolerant thermometer-to-binary encoder which reduces the encoding error in, for example, a 7-bit output binary code resulting from an out-of-sequence error in a 64-bit input thermometer code. The 64 1-bit signals of the thermometer code are grouped into four 16-bit subsets to form four smaller thermometer codes. Each thermometer code subset is then encoded into 5-bit binary form by a separate, conventional thermometer-to-binary encoder. The binary code outputs of the four encoders are then summed to produce the resulting binary code representing the 64-bit thermometer code. The 16-bit thermometer code subsets are grouped in such a way that each remains a legal 16-bit thermometer code as long as the out-of-sequence error in the 64-bit thermometer code has a span of less than 4. Thus, when the span of an error for the 64-bit thermometer code is less than 4, the described system produces no encoding errors. When the span is 4 or larger, encoding errors may occur, but in general they will be smaller in magnitude than the encoding errors in conventional thermometer-to-binary converters. However the described system still requires a substantial amount of hardware and processing time, but less hardware and processing time than a bit counting system.
Another problem associated with thermometer-to-binary conversion arises when a bit of the thermometer code is "metastable", at an invalid logic level intermediate in voltage between high and low logic levels. The output of a comparator is ideally one of two levels depending on the level of the input signal being sampled. But in practice a comparator may produce an output somewhere between high and low logic levels when the input signal voltage is sufficiently close to the reference voltage applied to the comparator. Also if the input voltage is changing rapidly when sampled, several comparators may produce metastable output signals simultaneously. To prevent invalid bits from being propagated through an encoder, the thermometer code output of an A/D converter is typically applied to a pipeline of clocked latches having positive feedback circuits to drive their outputs to stable high or low logic levels even when their inputs are at invalid ("metastable") levels. The stabilized output of each latch is then applied to the code conversion circuit. However this solution is hardware intensive since it requires many latches for each bit of the thermometer code.
In U.S. Pat. No. 4,733,220 issued Mar. 22, 1988 to Daniel G. Knierim, a thermometer-to-binary code converter uses a single stage latch array to stabilize all but the least significant bit of the thermometer code. The converter then converts the thermometer code to a Gray type (adjacent) binary code wherein only the least significant bit of the Gray code is metastable. The Gray code is then stabilized by a latch pipeline. The Gray code is subsequently converted to a standard binary form. Since the Gray code has fewer bits than the thermometer code, the number of latch stages required to produce the same degree of stability for a given clock rate is greatly reduced. However the system described in U.S. Pat. No. 4,733,220 can produce non-monotonic output in response to some out-of-sequence errors.
What is needed is a system for rapidly converting thermometer codes to binary codes which limits errors due to both out-of-sequence and metastable thermometer code bits and yet requires minimal hardware and processing time.